class Contact < ActiveRecord::Base
  belongs_to :event
  belongs_to :user
  has_one :invitation, :dependent => :destroy
  
  def avatar(size)
    if self.user.nil?
      'default_avatar_thumb.gif'
    else
      unless self.user.avatar.nil?
        self.user.avatar.public_filename(size)
      else
        'default_avatar_thumb.gif' 
      end
    end
  end
  
  def get_name
    if self.user.nil?
      self.name
    else
      self.user.public_name
    end
  end
  
end
